package com.isdinvestments.common.validation;

import java.util.Set;

import javax.validation.ConstraintViolation;

public class ConstraintViolationException extends javax.validation.ValidationException {
    private final Set<? extends ConstraintViolation<?>> constraintViolations;

    /**
     * Creates a constraint violation report
     *
     * @param message error message
     * @param constraintViolations <code>Set</code> of <code>ConstraintViolation</code>
     */
    public ConstraintViolationException(String message,
                                        Set<? extends ConstraintViolation<?>> constraintViolations) {
        super( message );
        this.constraintViolations = constraintViolations;
    }

    /**
     * Creates a constraint violation report
     *
     * @param constraintViolations <code>Set</code> of <code>ConstraintViolation</code>
     */
    public ConstraintViolationException(Set<? extends ConstraintViolation<?>> constraintViolations) {
        super();
        this.constraintViolations = constraintViolations;
    }

    /**
     * Set of constraint violations reported during a validation
     *
     * @return <code>Set</code> of <code>ConstraintViolation</code>
     */
    public Set<? extends ConstraintViolation<?>> getConstraintViolations() {
        return constraintViolations;
    }

}
